﻿@model FlyingCircusWebIS.ViewModels.AeronaveVM.AeronaveFormVM

@section css{
    @Styles.Render("~/Content/css/formulario")
}

<div id="outraspg">
    @{
        if (Model.Edicao)
        {
            ViewBag.Title = "Editar aeronave";
        <h1>Edite os dados da aeronave</h1>
        }
        else
        {
            ViewBag.Title = "Cadastrar aeronave";
        <h1>Informe os dados da aeronave</h1>
        }
    }


    @using (Html.BeginForm(FormMethod.Post))
    {     
        @Html.ValidationSummary(true)

        <div class="conteudodivs">
            <dl>
                @Html.HiddenFor(m => m.Edicao)
                @Html.HiddenFor(m => m.IdAeronave)
                <dd>
                    @Html.LabelFor(m => m.Descricao)
                    @Html.TextBoxFor(m => m.Descricao, new { @class = "textbox" })<br />
                    @Html.ValidationMessageFor(m => m.Descricao)
                </dd>
                <dd>
                    @Html.LabelFor(m => m.IdModeloAeronave)
                    @if (Model.Edicao)
                    {
                        string descricaoModeloAeronave = Model.ItensModeloAeronave.Find(e => e.Value == Model.IdModeloAeronave.ToString()).Text;
                        string idModeloAeronave = Model.ItensModeloAeronave.Find(e => e.Value == Model.IdModeloAeronave.ToString()).Value;
                        
                        <input type="text" value="@descricaoModeloAeronave" readonly="readonly" name="" />
                        <input type="text" hidden value="@idModeloAeronave" name="IdModeloAeronave" />
                    }
                    else
                    {
                        @Html.DropDownListFor(m => m.IdModeloAeronave, Model.ItensModeloAeronave, new { @class = "textbox" })
                    }
                    <br />
                    @Html.ValidationMessageFor(m => m.IdModeloAeronave)
                </dd>
                <dd>
                    <br />
                    @Html.CheckBoxFor(m => m.FlagAtivo)
                    @Html.LabelFor(m => m.FlagAtivo, new { @style = "display:inline; margin-left:2px" })
                </dd>
            </dl>
        </div>
        <div class="espacodasinfos">
            <input class="enviar" type="submit" value="Salvar" />
        </div>
    }

    <div class="voltar">
        @Html.ActionLink("Voltar", "Index")
    </div>
</div>


<!-- SCRIPTS -->

@section scripts{
    <!-- ActionChange -->
    <script type="text/javascript">
        $(document).ready(function () {
            $(".gerenciar").toggleClass("current");
        });
    </script>
}
